Public Function GetWizardInfo(Names As Variant) As Long
ReDim Names(NUM_WIZARDS)
GetWizardInfo = NUM_WIZARDS
End Function
'Enumerate the names and values of a specified property
Public Function GetEnumNames(ByVal PropID As Long, Names As Variant, Values As Variant) As Long
End Function
Public Function PageControls(ByVal ThisRegenMethod As Object, ByVal Graphic As Object, ByVal PageNumber As Long, ByVal SaveProperties As Boolean) As Boolean
'Set up error function
On Error GoTo Failed
Dim i%
Dim Diameter#
Dim SSolid%
If SaveProperties Then
'OK button on property page was clicked
'Form is still loaded
With frmNut3
'Need On Error statement for the case where you have
'RRect Turbo Shape and ahother "shape" selected
On Error Resume Next
'When the property page is closed, transfer the numeric
'Diameter value from the TextBox to the Graphic
'Get the value as a double-precision number
TypeN = .List1.Text
Diameter# = CDbl(.txtdd.Text)
If .Surf_Solid.Value = True Then
SSolid = False
ElseIf .Surf_Solid1.Value = True Then
SSolid = True
End If
'Set the property values in the Graphic
Graphic.Properties("Diameter") = Diameter#
Graphic.Properties("NutType") = TypeN
Graphic.Properties("NutSolid") = SSolid
End With
Else
'Property page is about to be opened
'Make sure the form is loaded
Load frmNut3
With frmNut3
'If more than one RRect is selected and they do not
'have the same properties, don't set up this field
On Error GoTo NoRType
'When the property page is opening, transfer the numeric
'roundness value from the Graphic to the TextBox
'Get the roundness property value from the Graphic
Diameter# = Graphic.Properties("Diameter")
TypeN = Graphic.Properties("NutType")
SSolid = Graphic.Properties("NutSolid")
'Set the TextBox control's text
.txtdd.Text = Diameter#
.List1.Text = TypeN
If SSolid = True Then
.Surf_Solid1.Value = True
.Surf_Solid.Value = False
ElseIf SSolid = False Then
.Surf_Solid1.Value = False
.Surf_Solid.Value = True
End If
NoRType:
End With
End If
PageControls = True
Exit Function
Failed:
'For debugging purposes, report that an error occurred
If Err.Number <> 0 Then
MsgBox "Error in PageControls: " & Err.Description
End If
'Return false if an error occurred
PageControls = False
End Function
Public Function PageDone(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant)
'Done with form
Unload frmNut3
End Function
Public Function PropertyPages(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant) As Boolean
With frmNut3
.Show vbModal
PropertyPages = Not .DialogCanceled
End With
End Function
Public Function Wizard(ByVal ThisRegenMethod As Object, Optional WizardNumber As Variant) As Boolean
Wizard = False
End Function
'Called when vertex has been moved, or other geometry change
Public Function OnGeometryChanged(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant)
'Do nothing
'Regen Graphic
End Function
'Called when vertex is moved, or other geometry change
Public Function OnGeometryChanging(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant) As Boolean
'OK to continue with change
OnGeometryChanging = True
End Function
Public Function OnNewGraphic(ByVal grfThis1 As Object, ByVal boolCopy As Boolean) As Boolean
If boolCopy Then
'Vertices are already added for us...
OnNewGraphic = True
Exit Function
End If
Dim grfThis As Graphic
Set grfThis = grfThis1
If grfThis.Application.ActiveDrawing.Properties("TileMode") <> imsiModelSpace Then
GoTo Failed
End If
On Error GoTo Failed
'New Graphic being created
'X, Y, Z, PenDown, Selectable, Snappable, Editable, Linkable
'First Vertex is "first point of axis"
grfThis.Vertices.Add 3#, 5#, 0#
'Second Vertex is "Second point of axis"
grfThis.Vertices.Add 4#, 5#, 0#, False
OnNewGraphic = True
Exit Function
Failed:
'Return false on failure
OnNewGraphic = False
End Function
'Function called whenever a copy of a graphic is being made
Public Function OnCopyGraphic(ByVal grfCopy As Object, ByVal grfSource As Object) As Boolean
'Return false on failure
OnCopyGraphic = True
End Function
'Notification function called after graphic property is saved
Public Function OnPropertyChanged(ByVal Graphic As Object, ByVal PropID As Long, _
ValueOld As Variant, ValueNew As Variant)
'Do nothing
End Function
'Notification function called when graphic property is saved
Public Function OnPropertyChanging(ByVal Graphic As Object, ByVal PropID As Long, _
ValueOld As Variant, ValueNew As Variant) As Boolean
'OK to proceed
OnPropertyChanging = True
End Function
'Notification function called when graphic property is retrieved
Public Function OnPropertyGet(ByVal Graphic As Object, ByVal PropID As Long)
'Do nothing
End Function
'Called when we need to update our object
Public Function Regen(ByVal grfThis1 As Object)
'Setup error handler
On Error GoTo Failed
Dim grfThis As Graphic
Set grfThis = grfThis1
'Set up lock (prevent recursion)
Dim LockCount&
LockCount& = grfThis.RegenLock
'Setup error handler (make sure lock is removed)
On Error GoTo FailedLock
If LockCount& = 0 Then
Dim TypeNn As String
'Delete any previous cosmetic children
TypeNn = grfThis.Properties("NutType")
Dim TypeNOld$
TypeNOld = grfThis.Properties("NutTypeOld")
Dim dd#, ddOld#
dd = grfThis.Properties("Diameter")
ddOld = grfThis.Properties("DiameterOld")
Dim NSolid%, NSolidOld%
NSolid = grfThis.Properties("NutSolid")
NSolidOld = grfThis.Properties("NutSolidOld")
Dim Salp#, Calp#, L#
Dim X00#, Y00#, Z00#, X01#, Y01#, Z01#
grfThis.Vertices.UseWorldCS = True
With grfThis.Vertices
X00 = .Item(0).X
Y00 = .Item(0).Y
Z00 = .Item(0).Z
X01 = .Item(1).X
Y01 = .Item(1).Y
Z01 = .Item(1).Z
End With
'Block to snap to Bolt's axis
'Dim GrSet As GraphicSet
'Dim CountGr As Long
'Dim i As Long
'Dim Gr1 As Graphic
'Dim X10#, Y10#, Z10#, X11#, Y11#, Z11#
' Set GrSet = grfThis.Drawing.Graphics.QuerySet("Type=SDK_Bolt_Screw")
If grfThis.Properties("Selected") = False Or Abs(L - HOld) > Eps Or CountCosm < 2 Or NSolid <> NSolidOld Or Abs(dd - ddOld) > Eps Or TypeNn <> TypeNOld Then
'defines the distance frof line to point in 3D space
Private Function DistPointLine(x0 As Double, y0 As Double, z0 As Double, x1 As Double, y1 As Double, z1 As Double, x2 As Double, y2 As Double, z2 As Double) As Double